package saxion.speelveld.spaceengineer.model;

import java.io.Serializable;

public class Resource implements Serializable
{
	private ResourceType resourceType;

	private int amount;

	private boolean reOccuring;

	private int amountGainPerTick;

	private int amountCostPerTick;

	public Resource(ResourceType resourceType)
	{
		this.resourceType = resourceType;
		setAmount(0);
	}

	public Resource(ResourceType resourceType, int amount)
	{
		this.resourceType = resourceType;
		this.setAmount(amount);
	}

	public Resource(ResourceType resourceType, int amount, boolean reOccuring)
	{
		this(resourceType, amount);
		this.reOccuring = reOccuring;
	}

	public ResourceType getResourceType()
	{
		return resourceType;
	}

	public void setResourceType(ResourceType resourceType)
	{
		this.resourceType = resourceType;
	}

	public int getAmount()
	{
		return amount;
	}

	public void setAmount(int amount)
	{
		this.amount = amount;
	}

	public boolean isReOccuring()
	{
		return reOccuring;
	}

	public void setReOccuring(boolean reOccuring)
	{
		this.reOccuring = reOccuring;
	}

	public int getAmountGainPerTick()
	{
		return amountGainPerTick;
	}

	public void setAmountGainPerTick(int amountGainPerTick)
	{
		this.amountGainPerTick = amountGainPerTick;
	}

	public void addAmountGainPerTick(int amountGainPerTickExtra)
	{
		setAmountGainPerTick(getAmountGainPerTick() + amountGainPerTickExtra);
	}

	public int getAmountCostPerTick()
	{
		return amountCostPerTick;
	}

	public void setAmountCostPerTick(int amountCostPerTick)
	{
		this.amountCostPerTick = amountCostPerTick;
	}

	public void addAmountCostPerTick(int amountCostPerTickExtra)
	{
		setAmountCostPerTick(getAmountCostPerTick() + amountCostPerTickExtra);
	}

	@Override
	public String toString()
	{
		return resourceType.toString() + ": " + amount;
	}

	public String toStringCurrentValueWithMaxValue(int maxValue)
	{

		return amount + " / " + maxValue;
	}

}
